package com.joshondesign.sdljava.gfx;

import java.io.File;

/**
 * Created by IntelliJ IDEA.
 * User: josh
 * Date: 9/10/11
 * Time: 4:02 PM
 * To change this template use File | Settings | File Templates.
 */
public abstract class Control extends Node {

    protected final SFont font;
    protected int x;
    protected int y;
    protected int width = 200;
    protected int height = 100;

    public Control() {
        font = new SFont(new File("src/resources/Junction.ttf"),24);
    }

    public Control setX(int x) {
        this.x = x;
        return this;
    }

    public Control setY(int y) {
        this.y = y;
        return this;
    }

    public Control setWidth(int width) {
        this.width = width;
        return this;
    }

    public Control setHeight(int height) {
        this.height = height;
        return this;
    }

    protected boolean inside(int mx, int my, int x, int y, int w, int h) {
        if(mx >= x && mx <= x + w) {
            if(my >=y && my<=y+h) {
                return true;
            }
        }
        return false;
    }
}
